﻿<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<title>订购业务</title>
	<#include "/header.html">
	<link rel="stylesheet" type="text/css" href="css/index.css">
</head>
<body>
<div id="rrapp" v-cloak class="tablediv">
	<h3 style="width: 100%;max-width: 100%;margin-bottom: 20px;text-align: center;">业务详情</h3>
	<table id="jqGrid" class="table table-hover choosetable"></table>
	<div id="jqGridPager"></div>
</div>

</div>
<!-- 模态框-->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
	<div class="modal-dialog">
		<div class="modal-content">
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
				<h4>绑定用户信息</h4>
			</div>
			<div style="padding:20px;">
				<label for="phone1">注册手机号：</label><br />
				<input id="phone1" type="text" autocomplete="off" placeholder="请输入已绑定的手机号"/>
			</div>
			<div style="padding:20px;">
				<label for="code1">验证码：</label>
				<div class="code1">
					<input id="code1" type="text" autocomplete="off" placeholder="短信验证码"/>
					<input id="btnSendCode1" type="button" class="btn btn-default" value="获取验证码" onClick="sendMessage1()" />
				</div>
			</div>
			<!--产品id-->
			<input type="text" id="cpid" style="display: none">
			<!--提醒短信内容-->
			<input type="text" id="warnMessage" style="display: none">
			<!--企业代码-->
			<input type="text" id="qCode" style="display: none">
			<!--产品代码-->
			<input type="text" id="pCode" style="display: none">
			<!--操作码-->
			<input type="text" id="oCode" style="display: none">
			<!--扣费类型-->
			<input type = "text" id ="kftype" style="display: none">
			<!--费率-->
			<input type="text" id="fee" style="display: none">
			<!--订购渠道-->
			<input type="text" id="oMethod" style="display: none">
			<div class="next">
				<button onclick="binding()">确定</button>
			</div>
		</div>
	</div>
</div>
<script>
    var phoneReg = /(^1[3|4|5|7|8]\d{9}$)|(^09\d{8}$)/;//手机号正则
    var count = 60; //间隔函数，1秒执行
    var InterValObj1; //timer变量，控制时间
    var curCount1;//当前剩余秒数
    /*获取验证码*/
    function sendMessage1() {
        curCount1 = count;
        var phone = $.trim($('#phone1').val());
        if(phoneReg.test(phone)){
            alert("验证码已发送，请注意查收");
        }else{
            alert(" 请输入有效的手机号码");
            return false;
        }
        //设置button效果，开始计时
        $("#btnSendCode1").attr("disabled", "true");
        $("#btnSendCode1").val( + curCount1 + "秒再获取");
        InterValObj1 = window.setInterval(SetRemainTime1, 1000); //启动计时器，1秒执行一次
        // 获取产品id，手机号，提醒短信内容,企业代码，产品代码，操作码，扣费类型，费率，订购渠道
        var product=$("#cpid").val(),
            mobile=$("#phone1").val(),
			message=$("#warnMessage").val(),
			qCode=$("#qCode").val(),
			pCode=$("#pCode").val(),
			oCode=$("#oCode").val(),
            kftype=$("#kftype").val(),
			fee=$("#fee").val(),
            oMethod=$("#oMethod").val();
        //向后台发送处理数据
        if(product){
            $.ajax({
                type:"Post",
                url:"",
                data:{
                    productID:product,
					userNumber:mobile,
					orderMsg:message,
					spid:qCode,
					serviceType:pCode,
					operatecode:oCode,
                    feeType:kftype,
					fee:fee,
					orderMethod:oMethod
                },
                success:function(result){
                    if(result.statusCode==1){}
                    else if(result.statusCode==0){
                        alert("输入成功");
                    }
                    else if(result.statusCode==2){
                        location.reload();
                    }
                },
                error:function(){
                    alert("响应消息有问题")
                }
            });
		}
    }
    function SetRemainTime1() {
        if (curCount1 == 0) {
            window.clearInterval(InterValObj1);//停止计时器
            $("#btnSendCode1").removeAttr("disabled");//启用按钮
            $("#btnSendCode1").val("重新发送");
        }
        else {
            curCount1--;
            $("#btnSendCode1").val( + curCount1 + "秒再获取");
        }
    }
    /*提交验证码*/
    function binding(){
        // 获取产品id，手机号，验证码，提醒短信内容,企业代码，产品代码，操作码，扣费类型，费率，订购渠道
        var product=$("#cpid").val(),
            mobile=$("#phone1").val(),
			code=$("#code1").val(),
            message=$("#warnMessage").val(),
            qCode=$("#qCode").val(),
            pCode=$("#pCode").val(),
            oCode=$("#oCode").val(),
            kftype=$("#kftype").val(),
            fee=$("#fee").val(),
            oMethod=$("#oMethod").val();
        $.ajax({
            type:"Post",
            url:"",
            data: {
                productID:product,
                userNumber:mobile,
                VerifiCode:code,
                orderMsg:message,
                spid:qCode,
                serviceType:pCode,
                operatecode:oCode,
                feeType:kftype,
                fee:fee,
                orderMethod:oMethod
            },
            success:function(result){
                if(result.statusCode==1){
                    alert("您已定制成功该业务");
                }
                else if(result.statusCode==0){
                    alert("验证码输入有误");
                }
            },
            error:function(){
                alert("响应消息有问题");
            }
        });
    }
</script>
<script src="${request.contextPath}/statics/js/modules/sys/order.js?_${.now?long}"></script>
</body>
</html>
